/*
    RoleCall provides a web service that web applications can use to find 
    the roles associated with a user that has been authenticated via OpenID. 
    Also provides a web-based user interface to manage the user roles 
    associated with partner web applications.
    
    Development of this software was supported in part by the David and Lucile 
    Packard Foundation and by the the Office Of Naval Research (ONR) 
     
    Copyright (c) 2012, 
    Monterey Bay Aquarium Research Institute - MBARI ( www.mbari.org )
    Michael Godin ( mikegodin AT users DOT sourceforge DOT net )

    RoleCall is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    RoleCall is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar (see the file COPYING.GPL).  If not, see 
    <http://www.gnu.org/licenses/>.  
*/

package org.mbari.rolecall.model;

import java.io.Serializable;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * RelayRole associates a Role with a Relay.
 * 
 * @author godin
 * 
 */
@SuppressWarnings("serial")
@DatabaseTable(tableName = RelayRole.TABLE_NAME)
public class RelayRole implements Serializable {

    public static final String FIELD_NAME_RELAY_ID = "relay_id";

    public static final String FIELD_NAME_ROLE_ID = "role_id";

    public static final String TABLE_NAME = "RelayRole";

    @DatabaseField(generatedId = true)
    protected int id;

    @DatabaseField(columnName = FIELD_NAME_RELAY_ID, indexName = "relay_role_idx", foreign = true)
    protected Relay relay;

    @DatabaseField(columnName = FIELD_NAME_ROLE_ID, indexName = "relay_role_idx", foreign = true)
    protected Role role;

    // No-arg constructor with at package visibility for persistence
    RelayRole() {
    }

    public RelayRole(Relay relay, Role role) {
        super();
        this.relay = relay;
        this.role = role;
    }

    /**
     * @return the id
     */
    public int getId() {
        return id;
    }

    /**
     * @return the relay
     */
    public Relay getRelay() {
        return relay;
    }

    /**
     * @return the role
     */
    public Role getRole() {
        return role;
    }

}
